1. Field of the invention
This invention relates to image generation, and more particularly, to a method and system for effectively displaying images.
2. Description of the Related Art
MS-RDPRFX (short for “Remote Desktop Protocol: RemoteFX Codec Extension”, Microsoft's MSDN library documentation), U.S. Pat. No. 7,460,725, US Pub. No. 2011/0141123 and US Pub. No. 2010/0226441 disclose a system and method for encoding and decoding electronic information. A tiling module of the encoding system divides source image data into data tiles. A frame differencing module compares the current source image, on a tile-by-tile basis, with similarly-located comparison tiles from a previous frame of input image data. To reduce the total number of tiles that requires encoding, the frame differencing module outputs only those altered tiles from the current source image that are different from corresponding comparison tiles in the previous frame. A frame reconstructor of a decoding system performs a frame reconstruction procedure to generate a current decoded frame that is populated with the altered tiles and with remaining unaltered tiles from a prior frame of decoded image data. Referring to the FIG. 1, the hatched portion Dp represents a different region between a current frame n and a previous frame n-1. The encoder examines the different region Dp and determines the set of tiles that correspond to those different regions Dp. In this example, tiles 2-3, 6-8 and 10-12 are altered tiles.
Microsoft's MSDN library documentation, such as Remote Desktop Protocol: Graphics Pipeline Extension (MS-RDPEGFX), Graphics Device Interface Acceleration Extensions (MS-RDPEGDI) and Basic Connectivity and Graphics Remoting Specification (MS-RDPBCGR), discloses a Graphics Remoting system. The data can be sent on the wire, received, decoded, and rendered by a compatible client. In this Graphics Remoting system, bitmaps are transferred from the server to an offscreen surface on the client, bitmaps are transferred between offscreen surfaces, bitmaps are transferred between offscreen surfaces and a bitmap cache, and a rectangular region is filled on an offscreen surface with a predefine color. For example, the system uses a special frame composition command “RDPGFX_MAP_SURFACE_TO_OUTPUT_PDU message” to instruct the client to BitBlit or Blit a surface to a rectangular area of the graphics output buffer (also called “shadow buffer” or “offscreen buffer” or “back buffer”) for displaying. After the graphics output buffer has been reconstructed completely, the whole frame image data are moved from the graphics output buffer to primary buffer (also called “front buffer”) for displaying (hereinafter called “single buffer structure”).
In the conventional single buffer architecture, the memory access includes operations of: (a) writing decoded data to a temporary buffer by a decoder, (b) then moving decoded data from the temporary buffer to the shadow surface (back buffer), (c) then moving full frame image content from the shadow surface to the primary surface for displaying. The shadow surface contains full frame image content of a previous frame in the single buffer architecture. Therefore, only the altered image region which contains image data of difference between a current frame and a previous frame needs to be moved from the temporary buffer to the shadow surface. After altered image data have been moved to the shadow surface, the full content of the shadow surface must be moved to the primary surface (front buffer or output buffer) for displaying. Thus, since the single buffer architecture needs a large amount of memory access, the system performance is dramatically reduced.
A major problem with this single buffer architecture is screen tearing. Screen tearing is a visual artifact where information from two or more different frames is shown in a display device in a single screen draw. For high resolution image, there is no enough time to move frame image content from the shadow surface (offscreen surface) to the primary surface in vertical retrace interval of display device. The most common solution to prevent screen tearing is to use multiple frame buffering, e.g. Double-buffering. At any one time, one buffer (front buffer or primary surface) is being scanned for displaying while the other (back buffer or shadow surface) is being drawn. While the front buffer is being displayed, a completely separate part of back buffer is being filled with data for the next frame. Once the back buffer is filled, the front buffer is instructed to look at the back buffer instead. The front buffer becomes the back buffer, and the back buffer becomes the front buffer. This swap is usually done during the vertical retrace interval of the display device to prevent the screen from “tearing”.